package com.xujl.fastlib.base;

import android.app.Application;
import android.content.Context;

import com.didichuxing.doraemonkit.DoraemonKit;
import com.xujl.fastlib.swipeback.ActivityHelper;
import com.xujl.fastlib.utils.ConfigManager;

/**
 * @author x
 * @Description
 */
public class BaseConfig {
    /**
     * 滑动返回需要的引用，如果去除了滑动返回库则应该清楚此变量相关引用
     */
    private ActivityHelper mActivityHelper;
    private Context mContext;

    private BaseConfig () {
    }

    public void init (Application application) {
        mContext = application;
        ConfigManager.getInstance().init(application);
        /*滑动返回引用变量初始化*/
        mActivityHelper = new ActivityHelper();
        application.registerActivityLifecycleCallbacks(mActivityHelper);
    }

    public static Context getContext () {
        return Holder.CONFIG.mContext;
    }

    public ActivityHelper getActivityHelper () {
        return mActivityHelper;
    }

    public static BaseConfig getInstance () {
        return Holder.CONFIG;
    }

    private static class Holder {
        private static final BaseConfig CONFIG = new BaseConfig();
    }
}
